import httpx

auth_header = {
    "Authorization": "Basic c2xwOjY4MjgwNA=="
}
test_path = "/Users/liangpengshi/my_file/test_file/webdav_storage/bj_sql/summary.sql"
test_path_2 = "/Users/liangpengshi/my_file/test_file/webdav_storage/new_folder2/S01E01.mkv"
req_url = "http://127.0.0.1:8002/dav_115/test_folder/inner_folder_2/some_file"


def data_feed(path: str):
    with open(path, "rb") as f:
        while True:
            chunk = f.read(1024 * 1024)
            if chunk:
                yield chunk
            else:
                break


with httpx.Client(headers=auth_header) as client:
    with open(test_path, "rb") as fr:
        body = fr.read()

    res = client.post(req_url, content=data_feed(test_path_2))
    print(res.json())
